<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../../css/iuapmobile.um.css">
		<link rel="stylesheet" href="../../css/font-icons.css">	
		<script src="../../js/summer.js" ></script>		
		<script src="../../js/jquery.min.js" ></script>
		<script src="../../js/Frameworks/iuapmobile.frameworks.ui.js" ></script>
		<script src="../../js/angular.min.js"></script>
	</head>
	<body ng-app="myApp" ng-controller="myCtrl">
		<div class="um-win" id="zhancunlist">
			<div class="um-header" >
				<a href="#" class="um-back back">返回 </a>
				<h3>拓展暂存</h3>
			</div>
			<div class="um-content">
				<ul class="um-list um-no-active f12">
						<li class="um-listview-row" ng-repeat="x in devices">
							<a href="#" class="um-list-item um-swipe-action um-no-icon">
								<div class="um-list-item-inner">
									<div class="um-list-item-body um-text-overflow f14" style="padding-right:5px;">
										<div class="um-bgc-gray um-white pt5 pb5">
											︱点位编号:<span>{{x.bdwh}}</span>
											<span class="fr">
												<i class="ti-close mr10"  ng-click="deleteDriver($index)"></i>
											</span>
										</div>
										<div class="um-box w ml15" ng-click="changePage($index)">
											<div class="um-bf1  mt5 mb5">
												商家经营名称
											</div>
											<div class="um-bf2 mt5 mb5" >
												<span>{{x.tsjjymc}}</span>
											</div>
										</div>
										<div class="um-box w ml15" ng-click="changePage($index)">
											<div class="um-bf1  mt5 mb5">
												暂存时间
											</div>
											<div class="um-bf2 mt5 mb5">
												<span>{{x.bqrrq}} {{x.bqrsj}}</span>
											</div>
										</div>
									</div>
								</div>
							</a>
						</li>
					</ul>
			</div>
			<div class="um-footer">
			</div>
		</div>
	</body>
</html>


<script>
	var key="拓展暂存";
	var sources;
	var angla;
	summerready = function(){
		sources = summer.getStorage(key);
		if(!sources){
			sources = [];
		}
		angla.devices = sources;
		angla.$apply();
	}
	var app = angular.module('myApp', []);
			app.controller('myCtrl', function($scope, $http) {
				angla = $scope;
				$scope.changePage = function(index) { //点击跳转选择点位 记录index
					UM.confirm({
						title: '友情提示:',
						text: '是否读取当前暂存点位？',
						btnText: ["取消", "读取"],
						overlay: true,
						ok: function() {
							var jsons = {
								pageid:"shangjiatuozhan",
								pageurl:"html/ShangJiaCaiJi/insert.html",
								cs:{
										zc:"y",
										data:sources[index]
								}
							};
							summer.execScript({
							    winId: "home",
							    script: "change("+ JSON.stringify(jsons) +")"
							});
							summer.closeToWin({
								id:"home"
							});
						},
						cancle: function() {}
					});
				}
				$scope.deleteDriver = function(index) { //删除设备
					UM.confirm({
						title: '友情提示:',
						text: '是否确认删除当前点位？',
						btnText: ["取消", "删除"],
						overlay: true,
						ok: function() {
							sources.splice(index, 1);
							console.log(sources);
							$scope.devices = sources;
							summer.setStorage(key,sources);
							$scope.$apply();
						},
						cancle: function() {}
					});
				}
			});
</script>

<script src="../../js/Myjs/Common.js"></script>